/**
 * 
 */
(function(mt) {
	mt.treeeditform = {
		inittree : function(el, idfield, parentfield, namefield, data, setting) {
			// 默认配置
			var defaultsetting = {
				view : {
					showIcon : false,
					nameIsHTML : true
				},
				data : {
					key : {
						name : namefield
					},
					simpleData : {
						enable : true,
						idKey : idfield,
						pIdKey : parentfield
					}
				},
				edit : {
					enable : true,
					showRemoveBtn : false,
					showRenameBtn : false,
					drag : {
						isCopy : true,
						isMove : true,
						prev : true,
						inner : true,
						next : true
					}
				},
				callback : {
					beforeDrag : function(treeId, treeNodes) {
						for (var i = 0, l = treeNodes.length; i < l; i++) {
							if (treeNodes[i].id <= 0) {
								return false;
							}
						}
						return true;
					},
					beforeDrop : function(treeId, treeNodes, targetNode, moveType) {
						return targetNode ? targetNode.drop !== false : true;
					}
				}
			};

			if (setting) {
				// 加载传入设置
				defaultsetting = $.extend(defaultsetting, setting);
			}

			zTree = $.fn.zTree.init($(el), defaultsetting, data);

			return zTree;
		}
	}
}(meeting));
